package com.springboot.starter.coderacademy.config;

import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@AutoConfigureAfter({CoderAcademyPropertiesAutoConfig.class})
@ConditionalOnBean({CoderAcademyConfig.class})
public class CoderAcademyServiceAutoConfig {
    @Bean
    @ConditionalOnMissingBean
    public CoderAcademyService coderAcademyService(CoderAcademyConfig coderAcademyConfig){
        return new CoderAcademyService(coderAcademyConfig);
    }
}